using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using OpenComposite.Repository.Properties;
using System.Drawing;
using OpenComposite.EII.Repository;
using OpenComposite.EII.Designer.Workflow;
using System.Xml.Serialization;
using System.Xml;
using System.IO;

namespace OpenComposite.EII.Designer.SCA
{
	public class HumanComponentSymbol : ServiceComponentSymbol
	{
		#region Initialization
		public HumanComponentSymbol()
		{
			init();
		}
		private void init()
		{
			this.BeginUpdate();

			this.BackBrushMode = BackgroundBrushMode.LinearGradient;
			this.BackLinearGradientMode = System.Drawing.Drawing2D.LinearGradientMode.Vertical;
			this.BackColor = Color.FromArgb(121, 137, 251);
			this.BackColor2 = Color.White;

			//this.ContextMenuStrip.Items.Insert(0, new ToolStripMenuItem("Properties...", null, new EventHandler(Properties_Click)));
			//this.ContextMenuStrip.Items.Insert(1, new ToolStripSeparator());

			this.EndUpdate();
		}
		#endregion

		#region Public Members

		#region Properties
		#endregion

		#region Methods
		public override void PaintBackground(PaintEventArgs pe)
		{
			base.PaintBackground(pe);

			Rectangle rc = this.ClientRectangle;
			Point pt = this.PointToDesignerView(new Point(rc.X, rc.Bottom - 16));
			pe.Graphics.DrawImage(Resources.png_user, pt.X, pt.Y);
		}
		#endregion

		#endregion

		#region Protected Members

		#region Variables
		#endregion

		#endregion

		#region Private Members

		#region Methods
		private HumanComponentProperties getProperties()
		{
			HumanComponentProperties props = null;
			Service svc = this.RepositoryItem as Service;
			if ( svc != null ) {
				props = svc.ExtendedProperties.HumanComponentProperties;
			}
			return props;
		}
		private void setProperties(HumanComponentProperties props)
		{
			Service svc = this.RepositoryItem as Service;
			if ( svc != null && props != null &&
				 svc.ExtendedProperties.HumanComponentProperties != props ) {
				svc.ExtendedProperties.HumanComponentProperties = props;
			}
		}
		#endregion

		#region Event Handlers
		//private void Properties_Click(object sender, EventArgs e)
		//{
		//    Service svc = this.RepositoryItem as Service;
		//    if ( svc != null ) {
		//        FormHumanTaskProperties frm = new FormHumanTaskProperties(svc);
		//        frm.ShowDialog();
		//    }

		//}
		#endregion

		#endregion
	}
}
